package com.durian.ui.adapter.multi;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;

/**
 * 说明：MultiTypeLifecycle
 * <p/>
 * 作者：fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2019-11-12 16:18
 * <p/>
 * 版本：version 1.0
 */
public class MultiTypeLifecycle implements LifecycleObserver {

    private MultiTypeAdapter adapter;

    public MultiTypeLifecycle(MultiTypeAdapter adapter){
        this.adapter = adapter;
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    public void destroy(){
        if (adapter != null){
            adapter.onDestroy();
        }
        adapter = null;
    }

}
